class Solution {
public:
    int reverse(int x) {
        // Note: The Solution object is instantiated only once and is reused by each test case.
        int ans=0;
        while (x!=0){
            ans=ans*10+x%10;
            x/=10;
        }
        return ans;
    }
};

